package com.ciaojian.miniapp.model.request;

/**
 * 登录凭证校验请求参数
 *
 * @author Atlakyn
 */
public class Code2Session extends BaseRequest {
    /**
     * 小程序 appId
     */
    private String appid;

    /**
     * 小程序 appSecret
     */
    private String secret;

    /**
     * 登录时获取的 code
     */
    private String js_code;

    /**
     * 授权类型，此处只需填写 authorization_code
     */
    private String grant_type;

    private Code2Session(Builder builder) {
        this.appid = builder.appid;
        this.secret = builder.secret;
        this.js_code = builder.js_code;
        this.grant_type = "authorization_code";
    }


    public static Builder builder() {
        return new Builder();
    }

    public static class Builder {
        private String appid;
        private String secret;
        private String js_code;

        public Builder appid(String appid) {
            this.appid = appid;
            return this;
        }

        public Builder secret(String secret) {
            this.secret = secret;
            return this;
        }

        public Builder js_code(String js_code) {
            this.js_code = js_code;
            return this;
        }

        public Code2Session build() {
            return new Code2Session(this);
        }
    }

    public String getAppid() {
        return appid;
    }

    public String getSecret() {
        return secret;
    }

    public String getJs_code() {
        return js_code;
    }

    public String getGrant_type() {
        return grant_type;
    }
}
